package com.exam.demo.repository;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import com.exam.demo.entity.Account;

public interface AccountRepository extends CrudRepository<Account,Integer>{

	/**
	 如实体类为 Account，则hql语句中应该为：
SELECT c.price FROM Account c
而不能随意写成SELECT c.price FROM account c或SELECT c.price FROM ACCOUNT c
	 * @param id
	 * @return
	 */
	@Query("select  a from Account a where a.id =?1")
	Account getUser(@Param("id") Integer id);
}
